<script type="text/javascript" >

function update_cont_size(){

 	var viewportheight;
  
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 if (typeof window.innerHeight != 'undefined')
 {
   viewportheight = window.innerHeight;
 }
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientHeight != 'undefined' 
     && document.documentElement.clientHeight != 0)
 {     
   viewportheight = document.documentElement.clientHeight;
 }
 // older versions of IE
 else
 {
   viewportheight = document.getElementsByTagName('body')[0].clientHeight;
 }

var headersize = document.getElementById("header").offsetHeight;
var footersize = document.getElementById("trailer").offsetHeight;


var minsize = 160;

var contentsize = viewportheight - (headersize + footersize + 38);

if(contentsize < minsize){
	contentsize = minsize;
}

document.getElementById("content").style.height = contentsize + "px";

}

window.onresize=function(){
	update_cont_size();
}

window.onload=function(){
	update_cont_size();
}

$(window).load(function() {    

	var theWindow        = $(window),
	    $bg              = $("#bg"),
	    aspectRatio      = $bg.width() / $bg.height();
	    			    		
	function resizeBg() {
		
		if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
		    $bg
		    	.removeClass()
		    	.addClass('bgheight');
		} else {
		    $bg
		    	.removeClass()
		    	.addClass('bgwidth');
		}
					
	}
	                   			
	theWindow.resize(function() {
		resizeBg();
	}).trigger("resize");

});

</script>